package com.xiaoxing.salesclient.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import com.jess.arms.di.scope.ActivityScope;

import javax.inject.Inject;

import com.xiaoxing.salesclient.mvp.contract.XuanZeFuWuRenYuanContract;
import com.xiaoxing.salesclient.mvp.model.entity.Staffs;
import com.xiaoxing.salesclient.mvp.model.entity.Transfer;
import com.xiaoxing.salesclient.mvp.model.entity.TransferXuanZe;
import com.xiaoxing.salesclient.mvp.model.entity.Transfered;
import com.xiaoxing.salesclient.mvp.model.service.SalesService;

import io.reactivex.Observable;


@ActivityScope
public class XuanZeFuWuRenYuanModel extends BaseModel implements XuanZeFuWuRenYuanContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public XuanZeFuWuRenYuanModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<Staffs> staffs(String access_token) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).staffs(access_token);
    }

    @Override
    public Observable<TransferXuanZe> transfer(String access_token, String order_id, String staff_id) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).transfer(access_token, order_id, staff_id);
    }

    @Override
    public Observable<Transfered> transfered(String access_token) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).transfered(access_token);

    }
}